package com.tlsy.commerce.model.multiTenant;

import com.tlsy.commerce.model.IdEntity;
import com.tlsy.commerce.multi_tenant.TenantHolder;
import lombok.Getter;
import lombok.Setter;
import org.eclipse.persistence.annotations.Multitenant;
import org.eclipse.persistence.annotations.TenantDiscriminatorColumn;

import javax.persistence.*;
import java.util.List;

/**
 * 买家购物车产品
 * @author Tlsy
 * @version commerce 0.0.1
 * @date 2017/4/13  15:08
 */
@Entity
@Table(name = "shopping_cart")
@Getter
@Setter
@Multitenant
@TenantDiscriminatorColumn(name = "user_id", length=42, contextProperty = TenantHolder.TENANT_ID)
public class ShoppingCart extends IdEntity{
    private static final long serialVersionUID = -924436346800036347L;

    @OneToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "shoppingCart_2_shelfProduct",joinColumns = {@JoinColumn(name = "shopping_cart_id")},inverseJoinColumns = {@JoinColumn(name = "shelf_product_id")})
    private List<ShelfProduct> shelfProducts;
}
